package com.dp.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dp.demo.entity.Order;
import com.dp.demo.mapper.OrderMapper;
import com.dp.demo.service.GoodsClient;
import com.dp.demo.service.OrderService;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: dupeng
 * @CreateTime: 2024-12-13  11:32
 * @Description: TODO
 */
@Service
@Slf4j
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {

    @Autowired
    private GoodsClient goodsClient;

    @Override
    @GlobalTransactional
    public void seataSave() {
        save(new Order(1, "PO1", "POName"));
        goodsClient.remoteSave();
    }
}
